package exercise.day11;

/**
 * @author Dianzhi Han
 * @version 1.0
 * @description: TODO
 * @date 2022/11/13 17:33
 */
public class CM24_LatestCommonAncestor {
    public int getLCA(int a, int b) {
// write code here
        while (a != b) {
            if (a > b) {
                a /= 2;
            } else {
                b /= 2;
            }
        }
        return a;
    }
}
